Skip to content

[12.x] Enum as queue overlap key#60722

Merged
taylorotwell merged 2 commits into
laravel:12.xfrom
finagin:feature/enum-as-queue-overlap-key
Jul 11, 2026
Merged

[12.x] Enum as queue overlap key#60722
taylorotwell merged 2 commits into
laravel:12.xfrom
finagin:feature/enum-as-queue-overlap-key

Conversation

@finagin

@finagin finagin commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This PR allows using Enum as a key for middleware WithoutOverlapping

Note

The changes are fully backward compatible and do not disrupt existing applications.

namespace App\Enums;

enum Category
{
    case suit;
    case dress;
}
namespace App\Jobs;

use App\Enums\Category;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Queue\Middleware\WithoutOverlapping;

class UpdateCategory implements ShouldQueue
{
    use Queueable;

    public function __construct(
        protected Category $category,
    ) {}

    public function middleware(): array
    {
        return [new WithoutOverlapping($this->category)];
    }

    public function __invoke(): void
    {
        // Some code
    }
}

@taylorotwell taylorotwell merged commit 5207516 into laravel:12.x Jul 11, 2026
70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants